#define DEBUG
#include <cstdio>

using namespace std;

const int maxn=1000000, maxm=1000000, mods=1000000007, inv2=500000004;

int main() {
  freopen("game.in", "r", stdin);
  freopen("game.out", "w", stdout);

  static long long row[maxn+1], col[maxm+1];
  long long n, m, k;
  scanf("%lld %lld %lld", &n, &m, &k);
  for (int i=1; i<=n; i++) {
    row[i] = 1;
  }
  for (int i=1; i<=m; i++) {
    col[i] = 1;
  }
  for (int i=1; i<=k; i++) {
    char c;
    int a, b;
    scanf(" %c %d %d", &c, &a, &b);
    if (c=='R') {
      row[a] = row[a]*b%mods;
    } else {
      col[a] = col[a]*b%mods;
    }
  }

  long long ans=0, x=0, y=0;
  for (long long i=1; i<=n; i++) {
    ans = (ans+(row[i]*((i-1)*m%mods+1+i*m%mods)%mods*m%mods*inv2%mods))%mods;
    y = (y+row[i])%mods;
    x = (x+((i-1)*m%mods+1)%mods*row[i]%mods)%mods;
  }
  for (long long i=1; i<=m; i++) {
    ans = (ans+(col[i]-1)*((y*(i-1)%mods+x)%mods)%mods)%mods;
  }
  printf("%lld", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
